/*-----------------------------------------------------------------------------
	The contents of this file are subject to the Mozilla Public License
	Version 1.1 (the "License"); you may not use this file except in
	compliance with the License.You may obtain a copy of the License at
	http://www.mozilla.org/MPL/MPL-1.1.html
	
	Software distributed under the License is distributed on an "AS IS"
	basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
	License for the specific language governing rights and limitations
	under the License.
	
	The Original Code is Fever Framework code.
	
	The Initial Developer of the Original Code is Romain Ecarnot.
	Portions created by Initial Developer are Copyright (C) 2006
	the Initial Developer. All Rights Reserved.
	
	Contributor(s):
	
	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-----------------------------------------------------------------------------*/

import org.aswing.Component;

/**
 * Wrapper for <strong>AsWing Components</strong> properties.
 * 
 * <p>AsWing components don't have any public properties ( like 'x', 'y, ... ), 
 * {@link FvEffectInstance} give access to components methods binding them on simple 
 * getter /setter public access, thus, classic tweening can be used.
 * 
 * <p>All {@link fvaswing.effects.FvTweenEffect} automatically build a 
 * {@link FvEffectInstance} before any tween process.
 *
 * @author Romain Ecarnot
 */
class fvaswing.effects.FvEffectInstance
{
	//-------------------------------------------------------------------------
	// Private properties
	//-------------------------------------------------------------------------
	
	private var _target : Component;
	
	
	//-------------------------------------------------------------------------
	// Public Properties
	//-------------------------------------------------------------------------
	
	/** Read-only. Current component target. */
	public function get target() : Component { return _target; }
	
	/** Component alpha value. */
	public function get alpha() : Number { return _target.getAlpha(); }
	public function set alpha( n : Number) : Void { _target.setAlpha( n ); }
	
	/** Component 'x' position. */
	public function get x() : Number { return _target.getX(); }
	public function set x( n : Number) : Void { _target.setX( n ); }
	
	/** Component 'y' position. */
	public function get y() : Number { return _target.getY(); }
	public function set y( n : Number) : Void { _target.setY( n ); }
	
	/** Component width. */
	public function get width() : Number { return _target.getWidth(); }
	public function set width( n : Number) : Void { _target.setWidth( n ); }
	
	/** Component height. */
	public function get height() : Number { return _target.getHeight(); }
	public function set height( n : Number) : Void { _target.setHeight( n ); }
	
	
	//-------------------------------------------------------------------------
	// Public API
	//-------------------------------------------------------------------------
	
	/**
	 * Constructor.
	 * 
	 * @param AsWing component target
	 */
	public function FvEffectInstance( comp : Component )
	{
		_target = comp;
	}
	
	/**
	 * Returns String representations.
	 */
	public function toString() : String
	{
		return 'FvEffectInstance on ' + _target.getName();	
	}
}